package cn.sun.controller;

import cn.sun.service.IProductService;
import cn.sun.domain.Product;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("product")
@RequiredArgsConstructor
public class ProductController {
    private final IProductService productService;

    @GetMapping("{pid}")
    public Product findById(@PathVariable("pid") Long pid){
        return productService.getById(pid);
    }
}
